function getMax(arr, L, R) {
  if (L == R) {
    return arr[L]
  }
  let mid = L + ((R - L) >> 1)
  let leftMax = getMax(arr, L, mid)
  let rightMax = getMax(arr, mid + 1, R)
  return Math.max(leftMax, rightMax)
}

console.log(getMax([1, 5, 6], 0, 2))
